{extend name='main'}

{block name="button"}

{if auth("add_users")}
<!--<button data-modal='{:url("add_users")}' data-title="添加等级" class='layui-btn'>添加等级</button>-->
{/if}

{/block}

{block name="content"}

<div class="think-box-shadow">

    <table class="layui-table margin-top-15" lay-filter="tab" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th lay-data="{field:'id',width:50}" class='text-left nowrap'>ID</th>
            <th lay-data="{field:'name',width:80}" class='text-left nowrap'>名称</th>
            <!--<th lay-data="{field:'pic',width:80}" class='text-left nowrap'>图标</th>-->
            <th lay-data="{field:'num',width:110}" class='text-left nowrap'>会员价格</th>
            <th lay-data="{field:'bili',width:110}" class='text-left nowrap'>佣金比例</th>
            <th lay-data="{field:'tj_bili',width:150}" class='text-left nowrap'>下级佣金比例</th>
            <th lay-data="{field:'num_min',width:120}" class='text-left nowrap'>最小余额</th>
            <th lay-data="{field:'order_num',width:80}" class='text-left nowrap'>接单次数</th>
            <th lay-data="{field:'tixian_ci',width:80}" class='text-left nowrap'>提现次数</th>
            <th lay-data="{field:'tixian_min',width:110}" class='text-left nowrap'>提现最小金额</th>
            <th lay-data="{field:'tixian_max',width:110}" class='text-left nowrap'>提现最大金额</th>
            <th lay-data="{field:'is_invite',width:110}" class='text-left nowrap'>邀请权限</th>
            <!--<th lay-data="{field:'addtime',width:200}" class='text-left nowrap'>注册时间</th>-->
            <th lay-data="{field:'edit',width:80,fixed: 'right'}" class='text-left nowrap'>操作</th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>

            <td class='text-left nowrap'>{$vo.id}</td>
            <td class='text-left nowrap'>{$vo.name}</td>
            <!--<td class='text-left nowrap'><img src="{$vo.pic}" alt="" style="width: 100%"></td>-->
            <td class='text-left nowrap'>{$vo.num}</td>
            <td class='text-left nowrap'>{$vo.bili}</td>
            <td class='text-left nowrap'>{$vo.tj_bili}</td>
            <td class='text-left nowrap'>{$vo.num_min}</td>
            <td class='text-left nowrap'>{$vo.order_num}</td>
            <td class='text-left nowrap'>{$vo.tixian_ci}</td>
            <td class='text-left nowrap'>{$vo.tixian_min}</td>
            <td class='text-left nowrap'>{$vo.tixian_max}</td>
            <td class='text-left nowrap'>
                {if $vo.is_invite==0}
                <a class="layui-btn layui-btn-danger layui-btn-xs">不允许</a>
                {else}
                <a class="layui-btn layui-btn-normal layui-btn-xs">允许</a>
                {/if}
            </td>
            <!--<td class='text-left nowrap'>{$vo.addtime|format_datetime}</td>-->
            <td class='text-left nowrap'>
                <a data-dbclick class="layui-btn layui-btn-xs" data-title="会员等级" data-modal='{:url("users/edit_users_level")}?id={$vo.id}'>编辑</a>
                <!--<a class="layui-btn layui-btn-xs layui-btn" onClick="del_user({$vo.id})" style='background:red;'>删除</a>-->

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    <script>
        function del_user(id){
            layer.confirm("确认要删除吗，删除后不能恢复",{ title: "删除确认" },function(index){
                $.ajax({
                    type: 'POST',
                    url: "{:url('delete_user')}",
                    data: {
                        'id': id,
                        '_csrf_': "{:systoken('delete_user')}"
                    },
                    success:function (res) {
                        layer.msg(res.info,{time:2500});
                        location.reload();
                    }
                });
            },function(){});
        }
    </script>
    <script>
        var table = layui.table;
        //转换静态表格
        var limit = Number('{$Think.get.limit}');
        if(limit==0) limit=20;
        table.init('tab', {
            cellMinWidth:120,
            skin: 'line,row',
            size: 'lg',
            limit: limit
        });
    </script>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>
{/block}
